package com.example.openim.controller;

import com.example.openim.service.OrgQueryService;
import com.example.openim.utils.AjaxResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: ZhangHuixin
 * @created: 2025-11-04 10:37:37
 */
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping("/in")
public class OrgController {

    private final OrgQueryService orgQueryService;

/**
 * API endpoint to query organizations based on the given zbmId parameter
 *
 * @param zbmId The identifier used to filter organizations
 * @return ResponseEntity containing a list of organizations that match the criteria
 *         Returns HTTP 200 OK with the list of organizations in the response body
 */
    @GetMapping("/queryOrg")
    private AjaxResult queryOrg(String zbmId) {
        return AjaxResult.success(orgQueryService.findOrgs(zbmId));
    }
}
